package com.rdxer;

import com.rdxer.core.utils.IdWorker;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@SpringBootApplication
//@EntityScan(basePackages = {
//        "com.rdxer.auth.model",
//        "com.rdxer.model",
//})
//@ComponentScan(basePackages = {
//        "com.rdxer",
//        "com.rdxer.core.security",
//})
//@EnableJpaRepositories(basePackages={
//        "com.rdxer.repository",
//})

@EnableTransactionManagement
@EnableScheduling // 启动定时任务
public class ServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(ServerApplication.class, args);
    }


    @Bean
    BCryptPasswordEncoder cryptPasswordEncoder() {
        return new BCryptPasswordEncoder();
    }

    @Bean
    IdWorker idWorker() {
        return new IdWorker(1, 1);
    }
}
